﻿//**********************************************************
//Copyright(C)2010 By 波特商网公司 版权所有。
//
//文件名：PermissionsPoint.cs
//文件功能：权限点重新组合帮助类
//
//创建标识：齐李平 || 2011-04-25
//
//修改标识：
//修改描述：
//**********************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Linq;

using Hmc.IM.Common;


namespace Hmc.IM.Client.Core
{
    /// <summary>
    /// 权限点重新组合帮助类
    /// </summary>
    public class PermissionsPoint
    {
        /// <summary>
        /// 权限点重新组合
        /// </summary>
        /// <param name=""powers"">功能权限点</param>
        /// <returns>返回权限列表</returns>
        public static List<int> AssemblyPowers(List<int> powers)
        {
            //Liping:临时添加所有权限到用户权限列表
            //var d = EnumHelper.GetDescriptions(typeof(StorePowers));
            //foreach (var item in d)
            //{
            //    powers.Add((int)(StorePowers)item.Key);
            //}

            #region 查找MenuConfig.xml文档获取权限点相对应的菜单和模块权限点并加入到权限列表中
            string xPath = System.IO.Directory.GetCurrentDirectory() + "\\MenuConfig.xml";

            if (System.IO.File.Exists(xPath) == true)
            {
                System.IO.File.Delete(xPath);
            }
            //if (System.IO.File.Exists(xPath) == false)
            //{
            //没有找到XML文件则生成一个默认的
            XmlBuilder(xPath);
            //}
            XDocument xdoc = XDocument.Load(xPath);
            IEnumerable<XElement> elementList = xdoc.Descendants("PermissionsPoint");

            List<string> menuList = new List<string>();//菜单和模块权限点集合
            foreach (int power in powers)
            {
                //StorePowers powerEnum = (StorePowers)power;//将权限值转换成枚举
                ////根据枚举查找出相对应的Xml节点
                //var query = (from p in elementList
                //             where p.Attribute("Key").Value == powerEnum.ToString()
                //             select p).SingleOrDefault();

                //if (query != null)
                //{
                //    //取该节点上级（也就是Menu）Id属性值
                //    string menudId = query.Parent.Attribute("Id").Value;
                //    if (string.IsNullOrEmpty(menudId) == false) menuList.Add(menudId);
                //    //取该节点上级（Menu）的上级（也就是Module）Id属性值
                //    string moduleId = query.Parent.Parent.Attribute("Id").Value;
                //    if (string.IsNullOrEmpty(moduleId) == false) menuList.Add(moduleId);
                //}
            }
            //过滤掉重复的权限点
            menuList = (from p in menuList select p).Distinct().ToList();
            #endregion

            //将menuList里的值加入到权限List
            foreach (string temp in menuList)
            {
                if (string.IsNullOrEmpty(temp) == false) powers.Add(Convert.ToInt32(temp));
            }
            return powers;
        }

        /// <summary>
        /// 生成菜单XML
        /// </summary>
        private static void XmlBuilder(string xPath)
        {
            #region XML字符串
            string xml = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
                                    <root>
                                      <Module Name=""系统设置"" Index=""0"" Key=""SystemManage_Module_Menu"" Id=""607000"">
                                        <Menu Name=""POS管理"" Key=""SystemManage_Pos_Menu"" Id=""607010"">
                                          <PermissionsPoint Key=""SystemManage_Pos_View"" >查看POS机</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Pos_Add"" >新增POS机</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Pos_Edit"" >修改POS机</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Pos_Verify"" >审核POS机</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""班次管理"" Key=""SystemManage_Shift_Menu"" Id=""607020"">
                                          <PermissionsPoint Key=""SystemManage_Shift_View"" >查看班次</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Shift_Add"" >新增班次</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Shift_Edit"" >修改班次</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Shift_Del"" >删除班次</PermissionsPoint>
                                        </Menu>
                                      </Module>
                                      <Module Name=""用户管理"" Index=""1"" Key=""SystemManage_Module_Menu"" Id=""601000"">
                                        <Menu Name=""组织机构"" Key=""SystemManage_Organization_Menu"" Id=""601010"">
                                          <PermissionsPoint Key=""SystemManage_Organization_View"" >查看组织机构</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Organization_Add"" >新增组织机构</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Organization_Edit"" >修改组织机构</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Organization_Del"" >删除组织机构</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""角色管理"" Key=""SystemManage_Role_Menu"" Id=""601020"">
                                          <PermissionsPoint Key=""SystemManage_Role_View"" >查看角色</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Role_Add"" >新增角色</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Role_Edit"" >修改角色</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_Role_Del"" >删除角色</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""帐户管理"" Key=""SystemManage_User_Menu"" Id=""601030"">
                                          <PermissionsPoint Key=""SystemManage_User_View"" >查看帐户</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_User_Add"" >新增帐户</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_User_Edit"" >修改帐户</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemManage_User_Del"" >删除帐户</PermissionsPoint>
                                        </Menu>
                                      </Module>
                                      <Module Name=""商家管理"" Index=""2"" Key=""MerchantManage_Module_Menu"" Id=""602000"">
                                        <Menu Name=""商家管理"" Key=""MerchantManage_Merchant_Menu"" Id=""602010"">
                                          <PermissionsPoint Key=""MerchantManage_Merchant_View"" >查看商家</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_Merchant_Add"" >新增商家</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_Merchant_Edit"" >修改商家</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_Merchant_Del"" >删除商家</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""合同管理"" Key=""MerchantManage_AttachContract_Menu"" Id=""602020"">
                                          <PermissionsPoint Key=""MerchantManage_AttachContract_View"" >查看合同</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_AttachContract_Add"" >新增合同</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_AttachContract_Edit"" >修改合同</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_AttachContract_Del"" >删除合同</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_AttachContract_Recall"" >撤消合同</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""营业员管理"" Key=""MerchantManage_Salesman_Menu"" Id=""602030"">
                                          <PermissionsPoint Key=""MerchantManage_Salesman_View"" >查看营业员</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_Salesman_Add"" >新增营业员</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_Salesman_Edit"" >修改营业员</PermissionsPoint>
                                          <PermissionsPoint Key=""MerchantManage_Salesman_Del"" >删除营业员</PermissionsPoint>
                                        </Menu>
                                      </Module>
                                      <Module Name=""物业管理"" Index=""3"" Key=""PropertyManage_Module_Menu"" Id=""604000"">
                                        <Menu Name=""大楼管理"" Key=""PropertyManage_Edifice_Menu"" Id=""604010"">
                                          <PermissionsPoint Key=""PropertyManage_Edifice_View"">大楼管理查看</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""楼层管理"" Key=""PropertyManage_EdificeStorey_Menu"" Id=""604020"">
                                          <PermissionsPoint Key=""PropertyManage_EdificeStorey_View"">大楼楼层查看</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_EdificeStorey_StoreyAdd"">新增楼层信息</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_EdificeStorey_StoreyEdit"">修改楼层信息</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""商铺管理"" Key=""PropertyManage_ShopMange_Meun"" Id=""604030"">
                                          <PermissionsPoint Key=""PropertyManage_ShopMange_View"">查看商铺列表</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_ShopMange_Edit"">修改商铺信息</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""仓库管理"" Key=""PropertyManage_Warehouse_Meun"" Id=""604040"">
                                          <PermissionsPoint Key=""PropertyManage_Warehouse_View"">临时场地查看</PermissionsPoint> 
                                        </Menu>
                                        <Menu Name=""临时场地"" Key=""PropertyManage_Warehouse_Meun"" Id=""604050"">
                                          <PermissionsPoint Key=""PropertyManage_Site_View"">临时场地查看</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_Site_Add"">临时场地新增</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_Site_Edit"">临时场地编辑</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_Site_Del"">临时场地删除</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_Site_AddPact"">临时场地签订合同</PermissionsPoint>   
                                        </Menu>
                                        <Menu Name=""场地合同"" Key=""PropertyManage_SitePact_Meun"" Id=""604060"">
                                          <PermissionsPoint Key=""PropertyManage_SitePact_View"">场地合同管理查看</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_SitePact_Edit"">场地合同编辑</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_SitePact_Del"">场地合同删除</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_SitePact_Audit"">场地合同审核</PermissionsPoint>   
                                        </Menu>
                                        <Menu Name=""广告位管理"" Key=""PropertyManage_Poter_Meun"" Id=""604070"">
                                          <PermissionsPoint Key=""PropertyManage_Poter_View"">广告位管理查看</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_Poter_Add"">广告位新增</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_Poter_Edit"">广告位编辑</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_Poter_Del"">广告位删除</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_Poter_AddPact"">广告位签订合同</PermissionsPoint>    
                                        </Menu>
                                        <Menu Name=""广告合同"" Key=""PropertyManage_PoterPact_Meun"" Id=""604080"">
                                          <PermissionsPoint Key=""PropertyManage_PoterPact_View"">广告合同查看</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_PoterPact_Edit"">广告合同编辑</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_PoterPact_Del"">广告合同删除</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_PoterPact_Audit"">广告合同审核</PermissionsPoint>    
                                        </Menu>
                                        <Menu Name=""电表管理"" Key=""PropertyManage_Ammeter_Menu"" Id=""604090"">
                                          <PermissionsPoint Key=""PropertyManage_Ammeter_View"">电表查看</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_Ammeter_Add"">电表新增</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_Ammeter_AddRecord"">新增抄表记录</PermissionsPoint>  
                                        </Menu>
                                        <Menu Name=""水表管理"" Key=""PropertyManage_Watermeter_Menu"" Id=""604100"">
                                          <PermissionsPoint Key=""PropertyManage_Watermeter_View"">水表查看</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_Watermeter_Add"">水表新增</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_Watermeter_AddRecord"">抄水表</PermissionsPoint>  
                                        </Menu>
                                        <Menu Name=""冷冻水"" Key=""PropertyManage_FreezeWatermeter_Menu"" Id=""604110"">
                                          <PermissionsPoint Key=""PropertyManage_FreezeWatermeter_View"">冷冻水查看</PermissionsPoint>
                                          <PermissionsPoint Key=""PropertyManage_FreezeWatermeter_Add"">冷冻水新增</PermissionsPoint> 
                                          <PermissionsPoint Key=""PropertyManage_FreezeWatermeter_AddRecord"">抄冷冻水表</PermissionsPoint>  
                                        </Menu>
                                      </Module>
                                      <Module Name=""商品管理"" Index=""4"" Key=""PorductManage_Module_Menu"" Id=""606000"">
                                        <Menu Name=""商品管理"" Key=""PorductManage_PorductInfo_Menu"" Id=""606010"">
                                         <PermissionsPoint Key=""PorductManage_PorductInfo_View"">商品详情</PermissionsPoint>
                                        </Menu>
                                      </Module>
                                      <Module Name=""仓储管理"" Index=""5"" Key=""StorageManage_Module_Menu"" Id=""605000"">
                                        <Menu Name=""商品库存"" Key=""StorageManage_StoreStorage_Menu"" Id=""605010"">
                                          <PermissionsPoint Key=""StorageManage_StoreStorage_View"">商品库存列表</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Cargo_Add"">领货</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""入库管理"" Key=""StorageManage_PutInStorage_Menu"" Id=""605020"">
                                          <PermissionsPoint Key=""StorageManage_PutInStorage_View"">查看入库单</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_PutInStorage_Add"">商品入库</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Goods_Add"">添加商品</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_PutInStorage_Repair"">补填发货单</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""领货管理"" Key=""StorageManage_Cargo_Menu"" Id=""605080"">
                                          <PermissionsPoint Key=""StorageManage_Cargoe_View"">领货查看</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""损耗管理"" Key=""StorageManage_Wastes_Menu"" Id=""605030"">
                                          <PermissionsPoint Key=""StorageManage_Wastes_View"">损耗列表</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Wastes_Add"">新增损耗</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""返厂管理"" Key=""StorageManage_Returned_Menu"" Id=""605040"">
                                          <PermissionsPoint Key=""StorageManage_Returned_View"">返厂列表</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Returned_Add"">返厂新增</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Returned_Edit"">返厂修改</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Returned_Audit"">返厂审核</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""报废管理"" Key=""StorageManage_Scrapped_Menu"" Id=""605050"">
                                          <PermissionsPoint Key=""StorageManage_Scrapped_View"">报废列表</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Scrapped_Add"">报废新增</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Scrapped_Edit"">报废修改</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Scrapped_Audit"">报废审核</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""库存盘点"" Key=""StorageManage_Check_Menu"" Id=""605060"">
                                          <PermissionsPoint Key=""StorageManage_Check_View"">盘点查看</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Check_Add"">新增盘点</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Check_Audit"">审核盘点</PermissionsPoint>
                                          <PermissionsPoint Key=""StorageManage_Check_Edit"">修改盘点</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""损耗列表"" Key=""StorageManage_Excessive_Menu"" Id=""605070"">
                                          <PermissionsPoint Key=""StorageManage_Excessive_View"">损耗查看</PermissionsPoint>
                                        </Menu>
                                      </Module>
                                    <Module Name=""会员管理"" Index=""6"" Key=""MemberManager_Module_Menu"" Id=""603000"">
                                        <Menu Name=""会员管理"" Key=""MemberManager_MemberServer_Menu"" Id=""603020"">
                                          <PermissionsPoint Key=""MemberManager_MemberServer_View"">查看会员服务</PermissionsPoint>
                                          <PermissionsPoint Key=""MemberManager_MemberServer_Add"">会员服务新增</PermissionsPoint>
                                          <PermissionsPoint Key=""MemberManager_MemberServer_Edit"">修改会员服务</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""会员充值"" Key=""MemberManager_PrepaidCard_Menu"" Id=""603030"">
                                          <PermissionsPoint Key=""MemberManager_PrepaidCard_Add"">充值</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""会员提现"" Key=""MemberManager_DrawMoney_Menu"" Id=""603040"">
                                          <PermissionsPoint Key=""MemberManager_DrawMoney_Add"">提现</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""补卡换卡"" Key=""MemberManager_Exchange_Menu"" Id=""603050"">
                                          <PermissionsPoint Key=""MemberManager_Exchange_View"">补卡换卡列表</PermissionsPoint>
                                          <PermissionsPoint Key=""MemberManager_Exchange_Add"">新增补卡换卡</PermissionsPoint>
                                        </Menu>
                                      </Module>
                                    <Module Name=""销售管理"" Index=""7"" Key=""SalesManage_Module_Menu "" Id=""609000"">
                                        <Menu Name="" 促销商品菜单"" Key=""SalesManage_Product_Menu"" Id=""609068"">
                                          <PermissionsPoint Key=""SalesManage_Product_View"">促销商品</PermissionsPoint>          
                                        </Menu>
                                        <Menu Name=""团购秒杀菜单"" Key=""SalesManage_TuanGouMiaoSha_Menu"" Id=""609065"">
                                          <PermissionsPoint Key=""SalesManage_TuanGouMiaoSha_View"">团购秒杀查看</PermissionsPoint>
                                          <PermissionsPoint Key="" SalesManage_TuanGouMiaoSha_Audit"">团购秒杀审核</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""打折抵扣"" Key=""SalesManage_Discount_Menu"" Id=""609060"">
                                          <PermissionsPoint Key=""SalesManage_Discount_View"">打折抵扣详情</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesManage_Discount_Add"">新增打折抵扣</PermissionsPoint>
                                          <PermissionsPoint Key="" SalesManage_Discount_Edit"">修改打折抵扣</PermissionsPoint>
                                          <PermissionsPoint Key="" SalesManage_Discount_Audit"">审核打折抵扣</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""大宗订单"" Key=""SalesManage_Promotion_Menu"" Id=""609056"">
                                          <PermissionsPoint Key=""SalesManage_LargeOrder_View"">大宗订单查看</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesManage_LargeOrder_Collect"">大宗订单集货</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesManage_LargeOrder_Send"">大宗订单发货</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""大宗购物"" Key=""SalesManage_LargeShopping_Menu"" Id=""609050"">
                                          <PermissionsPoint Key=""SalesManage_LargeShopping_View"">大宗购物列表</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesManage_LargeShopping_Add"">新增大宗购物</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesManage_LargeShopping_Edit"">修改大宗购物</PermissionsPoint>
                                        <PermissionsPoint Key=""SalesManage_LargeShopping_Audit"">审核大宗购物</PermissionsPoint>
                                        <PermissionsPoint Key=""SalesManage_LargeShopping_Order"">大宗购物生成订单</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""促销管理"" Key=""SalesManage_Promotion_Menu"" Id=""609010"">
                                          <PermissionsPoint Key=""SalesManage_Promotion_View"">促销列表</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesManage_Promotion_Add"">新增促销</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesManage_Promotion_Audit"">审核促销</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""销售流水"" Key=""SalesManage_SalesFlow_Menu"" Id=""609020"">
                                          <PermissionsPoint Key=""SalesManage_POSSalesOrder_View"">销售流水列表</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""实体订单"" Key=""SalesManage_POSSalesOrder_Menu"" Id=""609030"">
                                          <PermissionsPoint Key=""SalesManage_SalesFlow_View"">实体订单列表</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""网上订单"" Key=""SalesManage_B2CSalesOrder_Menu"" Id=""609040"">
                                          <PermissionsPoint Key=""SalesManage_B2CSalesOrder_View"">网上订单列表</PermissionsPoint>
                                        </Menu>
                                      </Module> 
                                      <Module Name=""售后服务"" Index=""8"" Key=""SalesService_Module_Menu"" Id=""610000"">
                                        <Menu Name=""线下退货"" Key=""SalesService_OfflineReturned_Menu"" Id=""610010"">
                                          <PermissionsPoint Key=""SalesService_OfflineReturned_View"">线下退货列表</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_OfflineReturned_Add"">新增线下退货</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_OfflineReturned_Back"">线下退货返仓/损耗</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""线下换货"" Key=""SalesService_OfflineReplacing_Menu"" Id=""610020"">
                                          <PermissionsPoint Key=""SalesService_OfflineReplacing_View"">线下换货列表</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""线上换货"" Key=""SalesService_WebReplacing_Menu"" Id=""610030"">
                                          <PermissionsPoint Key=""SalesService_WebReplacing_View"">线上换货列表</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_WebReplacing_Check"">线上换货检测</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_WebReplacing_SetGoods"">线上换货集货</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_WebReplacing_Delivery"">线上换货发货</PermissionsPoint>
                                        </Menu>
                                        <Menu Name=""线上退货"" Key=""SalesService_WebReturned_Menu"" Id=""610040"">
                                          <PermissionsPoint Key=""SalesService_WebReturned_View"">线上退货列表</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_WebReturned_Check"">线上退货检测</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_WebReturned_Back"">线上退货返厂/损耗</PermissionsPoint> 
                                        </Menu>
                                        <Menu Name=""线下投诉建议"" Key=""SalesService_Complaint_Menu"" Id=""610050"">
                                          <PermissionsPoint Key=""SalesService_Complaint_View"">线下投诉建议列表</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_Complaint_Add"">线下投诉建议新增</PermissionsPoint>
                                          <PermissionsPoint Key=""SalesService_Complaint_Edit"">线下投诉建议处理</PermissionsPoint> 
                                        </Menu>
                                      </Module> 
                                      <Module Name=""财务管理"" Index=""9"" Key=""FinancialManage_Module_Menu"" Id=""611000"">
                                        <Menu Name=""财务管理"" Key=""FinancialManage_Module_Menu"" Id=""611010"">
                                          <PermissionsPoint Key=""FinancialManage_Cash_View"">现金列表</PermissionsPoint>
                                          <PermissionsPoint Key=""FinancialManage_Cash_Add"">现金新增</PermissionsPoint>
                                        </Menu>
                                      </Module> 
                                      <Module Name=""消息管理"" Index=""10"" Key=""SystemMessage_Module_Menu"" Id=""608000"">
                                        <Menu Name=""系统消息"" Key=""SystemMessage_Message_Menu"" Id=""608010"">
                                          <PermissionsPoint Key=""SystemMessage_Message_View"">消息列表</PermissionsPoint>
                                          <PermissionsPoint Key=""SystemMessage_Message_Del"">删除消息</PermissionsPoint>
                                        </Menu>
                                      </Module> 
                                    </root>";
            #endregion
            try
            {
                XmlDocument xdoc = new XmlDocument();
                xdoc.LoadXml(xml);
                xdoc.Save(xPath);
            }
            catch (Exception ex) { throw ex; }
        }

    }
}
